(function() {
    // console.log("判断移动端");
    var sUserAgent = navigator.userAgent.toLowerCase();
    var siteName = window.location.pathname;

    var arr = []
    arr = siteName.split('/')
    // var id = window.location.search
    console.log('------------',arr)
    // if(id){
    //     var cs = id.split('?')[1]
    //     var cs_arr = cs.split('&')
    //     var params = {}
    //     for(var i = 0;i<cs_arr.length;i++){
    //         params[cs_arr[i].split('=')[0]] = cs_arr[i].split('=')[1]
    //     }
    // }
    
        if (/ipad|iphone|midp|rv:1.2.3.4|ucweb|android|windows ce|windows mobile/.test(sUserAgent)) {
            console.log("移动端");
            if(arr.length >= 3){
                if(arr[1] === 'inform'){
                    window.location.replace('https://m.51bmj.cn/' + `pages/policy/policyDetails?id=${arr[2]}&inform=通知`)
                }else if(arr[1] === 'gUDetails'){
                    window.location.replace('https://m.51bmj.cn/' + `pages/policy/policyDetails?id=${arr[2]}&inform=解读`)
                }else if(arr[1] === 'newInform'){
                    window.location.replace('https://m.51bmj.cn/' + `pages/policy/newsDetail?id=${arr[2]}`)
                }else{
                    //跳转移动端页面
                    window.location.replace("https://m.51bmj.cn/");//跳转后没有后退功能 
                }
            }else{
                //跳转移动端页面
                window.location.replace("https://m.51bmj.cn/");//跳转后没有后退功能 
            }
        } else {
            console.log("PC端",siteName);
        }
    // console.log(id,window.location)   
})();
